/*
 * File:   HyperEllipsoid.h
 * Author: jcrada
 *
 * Created on 23 July 2011, 1:36 PM
 */

#ifndef ECB_HYPERELLIPSOID_H
#define	ECB_HYPERELLIPSOID_H

#include "ecb/base/Problem.h"

namespace ecb {

    class HyperEllipsoid : public Problem {
    public:
        //Source: http://www.maths.uq.edu.au/CEToolBox/

        HyperEllipsoid(const std::string& id = "HyperEllipsoid", const std::string& name = "HyperEllipsoid",
                int dimensions = 0, scalar minimum = -5.12, scalar maximum = 5.12,
                bool minimization = true) :
        Problem(id, name, dimensions, minimum, maximum, minimization) { }

        scalar f(const std::vector<scalar>& x) {
            scalar result = 0.0;
            for (size_t i = 0; i < x.size(); i++) {
                result += (i + 1) * x[i] * x[i];
            }
            return result;
        }
    };
}

#endif	/* ECB_HYPERELLIPSOID_H */

